<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" >
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>支出证明支付列表</title>
        <script language="javascript">
            function showProj() {
                window.open("./pubinfo/projList.jsf", "项目列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateProjSelect(code, name) {
                document.getElementById('emp_cp:projCode').value = code;
                document.getElementById('emp_cp:projName').value = name;
            }

            function showDept() {
                window.open("./pubinfo/departmentList.jsf", "部门列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateDept(code, name) {
                document.getElementById('emp_cp:deptcode').value = code;
                document.getElementById('emp_cp:deptname').value = name;
            }
            function showCostItem() {
                window.open("./page/pay/check/ecoList.jsf", "经济分类", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateCostItemName(code, name) {
                document.getElementById('emp_cp:costcode').value = code;
                document.getElementById('emp_cp:costname').value = name;
            }
        </script>
        <style type="text/css">
            .inputstype{
                width: 100px !important;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id="emp_cp">
            <rich:panel header="支出证明支付列表" styleClass="content-hight">            
                <rich:collapsiblePanel header="查询条件"   switchType="client" expanded="false">
                    <h:panelGrid columns="4">
                        <h:outputLabel value="单据编号：" for="number" />
                        <h:inputText size="17" id="number" value="#{proofPay.qea.number}" />
                        <h:outputText value="单据日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{proofPay.qea.numDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false" inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{proofPay.qea.numDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                        </h:panelGroup>
                        <h:outputLabel value="单据状态："/>
                        <h:selectOneMenu value="#{proofPay.status}" style=" width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItems value="#{proofPay.payStatusList}"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="报销内容：" for="affair" />
                        <h:inputText size="17" id="affair" value="#{proofPay.qea.affair}" />
                        <h:outputLabel value="报销金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="totalStart" value="#{proofPay.qea.totalStart}"/>
                            - <h:inputText size="17" id="totalEnd" value="#{proofPay.qea.totalEnd}"/>
                        </h:panelGroup>
                        <h:outputLabel value="预算项目：" for="projName" />
                        <h:inputText size="17" id="projName" value="#{proofPay.qea.project.finName}"
                                     onclick="#{rich:component('projPanel')}.show();"/>
                        <h:outputLabel value="经手人员：" for="cpsn_name" />
                        <h:inputText size="17" id="cpsn_name" value="#{proofPay.qea.user.cpsn_number}" />
                        <h:outputLabel value="部门：" for="deptname"/>
                        <h:inputText size="17" id="deptname" value="#{proofPay.qea.dept.name}"
                                     onclick="#{rich:component('deptPanel')}.show();"/>
                        <h:outputLabel value="支出类别：" for="costClass" />
                        <h:selectOneMenu id="costClass" value="#{proofPay.qea.costClass}"
                                         style="width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItem itemValue="0" itemLabel="基本支出"/>
                            <f:selectItem itemValue="1" itemLabel="项目支出"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="预算来源：" for="budgetSource" />
                        <h:inputText size="17" id="budgetSource" value="#{proofPay.qea.budgetSource}"/>
                        <h:outputLabel value="经济分类：" for="costname" />
                        <h:inputText size="17" id="costname" value="#{proofPay.qea.costitem.name}"
                                     onclick="showCostItem();" />
                        <h:outputLabel value="支出渠道：" for="costType" />
                        <h:selectOneMenu  id="costType" value="#{proofPay.qea.costTypes.code}"
                                          style=" width: 125px;">
                            <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                            <f:selectItems value="#{class.selectItemList}" />
                        </h:selectOneMenu>
                        <h:outputLabel value="支付令：" for="paycode" />
                        <h:inputText size="17" id="paycode" value="#{proofPay.qea.paycode}" />
                        <h:outputLabel value="核定金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="checkaccountStart" value="#{proofPay.qea.checkaccountStart}"/>
                            - <h:inputText size="17" id="checkaccountEnd" value="#{proofPay.qea.checkaccountEnd}"/>
                        </h:panelGroup>
                        <h:outputText value="审核日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{proofPay.qea.auditDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false" inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{proofPay.qea.auditDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false" inputClass="inputstype"/>
                        </h:panelGroup>
                        <h:outputLabel value="支付金额：" />
                        <h:panelGroup>
                            <h:inputText size="17" id="payaccountStart" value="#{proofPay.qea.payaccountStart}"/>
                            - <h:inputText size="17" id="payaccountEnd" value="#{proofPay.qea.payaccountEnd}"/>
                        </h:panelGroup>
                        <h:outputText value="支付日期："/>
                        <h:panelGroup>
                            <rich:calendar value="#{proofPay.qea.payDateStart}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                            至
                            <rich:calendar value="#{proofPay.qea.payDateEnd}"
                                           locale="zh_CN"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"  inputClass="inputstype"/>
                        </h:panelGroup>                          
                        <h:inputHidden id="costcode" value="#{proofPay.qea.costitem.code}"/>
                    </h:panelGrid>
                </rich:collapsiblePanel>                  

                <h:commandButton value="查询" action="#{proofPay.queryExpenseAccount}"/>
                <h:commandButton value="取消" action="#{proofPay.queryCancel}"/>
                <h:commandButton value="导出Excel" action="#{proofPay.exportExcel}"
                                 disabled="#{proofPay.billModel.rowCount le 0}" />

                <div style="width:100%;overflow:auto">
                    <rich:dataTable id="appList" value="#{proofPay.billModel}" var="proofs" rows="10"
                                    rowClasses="list-row-odd,list-row-even" style=" width: 1800px;"
                                    headerClass="table-header">
                        <rich:column sortBy="#{proofs.number}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据编号"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:commandLink action="#{proofPay.showVoucher}" >
                                <h:outputText value="#{proofs.number}"/>
                            </h:commandLink>
                        </rich:column>
                        <rich:column sortBy="#{proofs.numDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.numDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>
                        <rich:column sortBy="#{proofs.numberStatus}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="单据状态"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="等待审核"  rendered="#{proofs.numberStatus == '0'}" style="color:green"/>
                            <h:outputText value="等待支付"  rendered="#{proofs.numberStatus == '2'}" style="color:green"/>
                            <h:outputText value="退回修改"  rendered="#{proofs.numberStatus == '3'}" style="color:red"/>
                            <h:outputText value="确认支付"  rendered="#{proofs.numberStatus == '4'}" style="color:blue"/>
                            <h:outputText value="支付完毕"  rendered="#{proofs.numberStatus == '6'}" style="color:blue"/>
                        </rich:column>
                        <rich:column sortBy="#{proofs.payDept.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="部门"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.payDept.name}"/>
                        </rich:column>
                        <rich:column sortBy="#{proofs.feePer.cpsn_name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="经手人员"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.feePer.cpsn_name}"/>
                        </rich:column>
                        <rich:column sortBy="#{proofs.project.finName}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算项目"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.project.finName}"/>
                        </rich:column>

                        <rich:column sortBy="#{proofs.affair}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="报销内容"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.affair}"/>
                        </rich:column>

                        <rich:column sortBy="#{proofs.total}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="报销金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.total}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{proofs.costClass}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支出类别"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="基本支出" rendered="#{proofs.costClass == '0'}"/>
                            <h:outputText value="项目支出" rendered="#{proofs.costClass == '1'}"/>
                        </rich:column>

                        <rich:column sortBy="#{proofs.budgetSource}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算来源"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.budgetSource}"/>
                        </rich:column>

                        <rich:column sortBy="#{proofs.costitem.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="经济分类"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.costitem.name}"/>
                        </rich:column>

                        <rich:column sortBy="#{proofs.costTypes.name}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支出渠道"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.costTypes.name}"/>
                        </rich:column>

                        <rich:column sortBy="#{proofs.paycode}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付令"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.paycode}" style="width:350px" />
                        </rich:column>

                        <rich:column sortBy="#{proofs.checkaccount}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="核定金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.checkaccount}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{proofs.repayment}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="还款金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.repayment}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{proofs.remain}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="待支付金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.remain}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{proofs.auditDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.auditDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{proofs.auditor}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核人"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.auditor}"/>
                        </rich:column>

                        <rich:column sortBy="#{proofs.payaccount}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.payaccount}">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{proofs.payDate}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="支付日期"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.payDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>

                        <rich:column sortBy="#{proofs.payer}">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="出纳"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{proofs.payer}"/>
                        </rich:column>

                        <f:facet name="footer">
                            <rich:dataScroller id="ds"></rich:dataScroller>
                        </f:facet>
                    </rich:dataTable>
                </div>
            </rich:panel>
        </h:form>
        <rich:popupPanel id="projPanel" autosized="true">
            <f:facet name="header">项目信息</f:facet>
            <f:facet name="controls">
                <h:outputLink value="#" onclick="#{rich:component('projPanel')}.hide();">关闭</h:outputLink>
            </f:facet>
            <h:form id="projList">
                <rich:dataTable id="editTable" value="#{proofPay.finProjModel}" rows="10"  var="pro"
                                onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                rowClasses="list-row-odd,list-row-even">
                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="预算项目编码"/>
                            </h:panelGroup>
                        </f:facet>
                        <a4j:commandLink id="Projlinks" action="#{proofPay.selectProjForQuery}"
                                         onclick="#{rich:component('projPanel')}.hide();"
                                         render="projName" >
                            <h:outputText value="#{pro.finCode}"/>
                        </a4j:commandLink>
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="预算项目名称"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pro.finName}"/>
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="备注"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pro.memo}"/>
                    </rich:column>

                    <f:facet name="footer">
                        <rich:dataScroller id="ds"></rich:dataScroller>
                    </f:facet>
                </rich:dataTable>
            </h:form>
        </rich:popupPanel>
        <rich:popupPanel id="deptPanel" autosized="true">
            <f:facet name="header">
                <h:panelGroup>
                    <h:outputText value="费用承担部门"></h:outputText>
                </h:panelGroup>
            </f:facet>
            <f:facet name="controls">
                <h:outputLink value="#" onclick="#{rich:component('deptPanel')}.hide();">关闭</h:outputLink>
            </f:facet>
            <h:form>
                <rich:panel>
                    <h:panelGrid columns="2" width="100%" border="0" id="mainform">
                        <rich:tree value="#{departmentBean.rootNode}" var="idept"
                                   selectionType="ajax" toggleType="client"
                                   selectionChangeListener="#{proofPay.selecteDeptForQuery}"
                                   style="width:300px" render="deptname">
                            <rich:treeNode>
                                <h:outputText value="[#{idept.data.code}]#{idept.data.name}" />
                                <rich:componentControl target="deptPanel" operation="hide" event="click"/>
                            </rich:treeNode>
                        </rich:tree>
                    </h:panelGrid>
                </rich:panel>
            </h:form>

            <f:facet name="footer">
                footer!
            </f:facet>

        </rich:popupPanel>
    </h:body>
</html>

